#define _CRT_SECURE_NO_WARNINGS 1

// P1003
/********************************************************
#include <iostream>
#include <vector>
using namespace std;

const int N = 2e5 + 1;
typedef struct blanket {
	int a, b, x, y;
};
int main()
{
	int n; cin >> n;
	vector<blanket> mp(n+1);
	for (int i = 1; i <= n; i++) {
		cin >> mp[i].a >> mp[i].b >> mp[i].x >> mp[i].y;
	}

	int ans = -1;
	int qx, qy; cin >> qx >> qy;
	for (int i = 1; i <= n; i++) {
		if ((qx >= mp[i].a && qx <= mp[i].a + mp[i].x) && (qy >= mp[i].b && qy <= mp[i].b + mp[i].y))
			ans = i;
	}
	cout << ans << endl;
	return 0;
}
********************************************************/


